<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        #box{
            width: 100px;
            padding: 100px;
            background: red;
        }
    </style>
</head>

<body>
    <ul>
        <li>1</li>
        <li>2</li>
        <li>3</li>
        <li>4</li>
        <li>5</li>
        <li>6</li>
        <li>7</li>
        <li>8</li>
        <li>9</li>
        <li>10</li>
    </ul>
    <script>
        //forEach 方法
        var arr = [1,2,3,4,5,6]
        Array.prototype.forEach = function(handler,newThis){
            for(var i in this){
                handler.call(newThis,this[i],i,this)
            }
        }
        arr.forEach(function(value,index,self){
            console.log(value,index,self);
        },[])
        
        //map 方法
        Array.prototype.map = function(handler,newThis){
            var arr = []
            for (var i in this){
                var newRes = handler.call(newThis, this[i], i, this)
                arr.push(newRes)
            }
            return arr
        }   
        var arr1 = arr.map(function(value , index, self){
            console.log(value ,index, self);
            return value + 10
        },[])
        console.log(arr1);

        //filter
        Array.prototype.filter = function(){
            var arr = []
            
        }
    </script>
</body>

</html>